﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>驰骋工作流</title>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>

    <script type="text/javascript" language="javascript" >
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });
        //初始化数据.
        function InitPage() {

            var fk_node = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Node", fk_node);

            //调用公共类库的方法:执行批量主表赋值
            GenerFullAllCtrlsVal(node);

            var doc = node.TurnToDealDoc.replace('~', '\'');
            doc = doc.replace('~', '\'');
            doc = doc.replace('~', '\'');
            doc = doc.replace('~', '\'');

            switch (node.TurnToDeal) {
                case '0':
                case '1':
                    $('#TB_SpecMsg').val(doc);
                    break;
                case '2':
                case '3':
                    $('#TB_SpecURL').val(doc);
                    break;
                default:
            }
            rb_onchange(node.TurnToDeal);
            return;
        }


        //ajax 提交
        function Btn_Save_Click() {

            var checkBoxIDs = GenerCheckIDs(); //获得所有的 checkBox ID传入到后台去,用于解决checkbox控件，在没有被选择的时候，没有值的问题。
            var frmData = $("#cc").serialize();


            var fk_node = GetQueryString("FK_Node");

            var node = new Entity("BP.WF.Node", fk_node);
            var turnToDeal = $("input[name='TurnToDeal']:checked").val();
            node.TurnToDeal = turnToDeal;

            if (node.TurnToDeal == 1) 
                node.TurnToDealDoc = $("#TB_SpecMsg").val();

            if (node.TurnToDeal == 2)
                node.TurnToDealDoc = $("#TB_SpecURL").val();

            if (node.TurnToDeal != 0) {
                if (node.TurnToDealDoc == '') {
                    alert('执行内容没有填写');
                    return;
                }
            }

            node.Update();

            window.location.href = window.location.href;

        }

        function rb_onchange(obj) {
            
            if (obj == 1) {
                document.getElementById("TB_SpecURL").value = "";
                document.getElementById("TB_SpecURL").readOnly = true;
                document.getElementById("TB_SpecMsg").readOnly = false;
            } else if (obj == 2) {
                document.getElementById("TB_SpecMsg").value = "";
                document.getElementById("TB_SpecMsg").readOnly = true;
                document.getElementById("TB_SpecURL").readOnly = false;
            } else {
                document.getElementById("TB_SpecMsg").value = "";
                document.getElementById("TB_SpecMsg").readOnly = true;
                document.getElementById("TB_SpecURL").value = "";
                document.getElementById("TB_SpecURL").readOnly = true;
            }
        } 
    </script>
</head>
<body  >

<form id="cc">
 
 <table style="width: 100%">
        <caption>
            发送后转向处理规则
            <tr>
                <td valign="top" style="width:70%">
                    <fieldset>
                        <legend>
                            <input type="radio" ID="RB_TurnToDeal_0" name="TurnToDeal" runat="server" value="0"
                                onclick="rb_onchange(0)" /><label for="RB_TurnToDeal_0"> 提示ccflow默认信息</label></legend>
                        <ul style="color: Gray">
                            <li>默认为不设置，按照机器自动生成的语言提示，这是标准的信息提示。</li>
                            <li>比如：您的当前的工作已经处理完成。下一步工作自动启动，已经提交给xxx处理。 </li>
                        </ul>
                    </fieldset>
                    <fieldset>
                        <legend>
                            <input type="radio" ID="RB_TurnToDeal_1" name="TurnToDeal"  value="1"
                                onClick="rb_onchange(1)" /><label for="RB_TurnToDeal_1">提示指定信息 </label> - <a href="javascript:ShowHidden('SpecMsg')">帮助:</a>
                        </legend>
                        <div id="SpecMsg" style="display: none">
                            <ul style="color: Gray">
                                <li>按照您定义的信息格式，提示给已经操作完成的用户。</li>
                                <li>比如：您的申请已经发送至XXX用户进行审批。 </li>
                                <li>该自定义信息支持ccbpm的表达式，具体可参考右侧帮助文档。 </li>
                                <li>发送后系统变量如下: </li>
                                <li>您可以设置为: 当前工作提交给:【 @VarAcceptersName 】处理. </li>
                                <li>例如：您的请假申请单，已经提交给 @VarAcceptersName ，提交到：  @VarToNodeName , 请假了@QingJiaTianTianShu天.</li>
                            </ul>
                           
                        </div>
                        <input type="text" ID="TB_SpecMsg" name="TB_SpecMsg" runat="server" TextMode="MultiLine" Rows=3  style="width:90%"/>
                    </fieldset>
                    <fieldset>
                        <legend>
                            <input type="radio" ID="RB_TurnToDeal_2" name="TurnToDeal" runat="server" value="2"
                                onClick="rb_onchange(2)" /><label for="RB_TurnToDeal_2"> 转向指定的URL </label>- <a href="javascript:ShowHidden('SpecUrl')">帮助:</a>
                        </legend>
                        <div id="SpecUrl" style="display: none">
                            <ul style="color: Gray">
                                <li>按照您定义的url转向，可处理较为复杂的业务逻辑处理。</li>
                                <li>比如：URL为MyFlow.htm页面或www.baidu.com。 </li>
                                <li>该URL支持ccbpm参数形式，具体传值参考右侧帮助。 </li>
                                <li>启动子流程实例: /WF/MyFlow.htm?FK_Flow=003&PFlowNo=002 </li>
                            </ul>
                        </div>
                        <input type="text" ID="TB_SpecURL" name="TB_SpecURL" runat="server" style="width:90%"/>
                    </fieldset>
                </td>
                <td valign="top" style="width:28%">
                    <fieldset>
                        <legend>帮助</legend>
                        <ul style="color: Gray">
                            <li><a href="http://ccbpm.mydoc.io/?v=5404&t=17914" target="_blank">提示ccflow默认信息</a></li>
                            <li><a href="http://ccbpm.mydoc.io/?v=5404&t=17914" target="_blank">提示指定信息</a></li>
                            <li><a href="http://ccbpm.mydoc.io/?v=5404&t=17914" target="_blank">转向指定的URL</a></li>
                        </ul>
                    </fieldset>


                     <fieldset>
                        <legend>发送后系统参数</legend>
                        <table>
                            <tr> <th>变量名</th> <th>中文名</th> </tr>
                            <tr> 
                            <td>VarCurrNodeID</td>	 
                            <td>当前节点ID</td>	 
                            </tr> 

                             <tr> 
                            <td>VarCurrNodeName</td>	 
                            <td>当前节点名称</td>	 
                            </tr> 

                             <tr> 
                            <td>VarToNodeID</td>	 
                            <td>到达节点ID</td>	 
                            </tr> 

                             <tr> 
                            <td>VarToNodeName</td>	 
                            <td>到达节点名称</td>	 
                            </tr> 

                             <tr> 
                            <td>VarAcceptersName</td>	 
                            <td>接受人集合的名称(用逗号分开)</td>	 
                            </tr> 

                             <tr> 
                            <td>VarAcceptersID</td>	 
                            <td>接受人集合的ID(用逗号分开)</td>	 
                            </tr> 

                             <tr> 
                            <td>VarAcceptersNID</td>	 
                            <td>接受人集合的ID&Name(用逗号分开)</td>	 
                            </tr> 
                            </table>
                    </fieldset>

                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <input type="button" ID="Btn_Save" runat="server" value="保存" onclick="Btn_Save_Click()" />
                </td>
            </tr>
    </table>

</form>

</body>
</html>
